package com.alibaba.citrus.cr.sales.plan.model.enums;

import java.util.Arrays;

/**
 * @author luyi
 * @date 2021/10/13 6:03 下午
 */
public enum StatPoolTypeEnum {
    /**
     * 汇总类型
     */
    CUSTOMER(1,"客户"),
    SC_ITEM(2,"货品"),
    ORGANIZATION(3,"组织"),
    CATEGORY(4,"类目")
    ;
    /**
     * 汇总类型2：货品维度3：组织维度4：类目维度
     */
    private final Integer poolType;

    private final String desc;

    StatPoolTypeEnum(Integer poolType, String desc) {
        this.poolType = poolType;
        this.desc = desc;
    }

    public Integer getPoolType() {
        return poolType;
    }

    public String getDesc() {
        return desc;
    }

    public static StatPoolTypeEnum getByPoolType(Integer poolType){
        if (poolType == null){
            return null;
        }
        return Arrays.stream(values()).filter(typeEnum -> typeEnum.getPoolType().equals(poolType)).findAny().orElse(null);
    }
}
